﻿CREATE TABLE [dbo].[PersonKursTillfalle] (
    [Id]              UNIQUEIDENTIFIER NOT NULL,
    [ValId]           UNIQUEIDENTIFIER NOT NULL,
    [Skapad]          DATETIME         NOT NULL,
    [SkapadAv]        NVARCHAR (50)    NOT NULL,
    [Andrad]          DATETIME         NULL,
    [AndradAv]        NVARCHAR (50)    NULL,
    [PersonId]        UNIQUEIDENTIFIER NULL,
    [KursTillfalleId] UNIQUEIDENTIFIER NOT NULL,
    [Status]          NVARCHAR (50)    CONSTRAINT [DF_PersonKursTillfalle_Status] DEFAULT (N'Placerad') NOT NULL,
    CONSTRAINT [PK_PersonKursTillfalle] PRIMARY KEY CLUSTERED ([Id] ASC, [ValId] ASC),
    CONSTRAINT [FK_PersonKursTillfalle_KursTillfalle] FOREIGN KEY ([KursTillfalleId], [ValId]) REFERENCES [dbo].[KursTillfalle] ([Id], [ValId]),
    CONSTRAINT [FK_PersonKursTillfalle_Person] FOREIGN KEY ([PersonId], [ValId]) REFERENCES [dbo].[Person] ([Id], [ValId])
);





